package solution;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: ws
 * Date: 2023-01-21
 * Time: 14:54
 */


//https://leetcode.cn/problems/first-bad-version/submissions/396564691/
    //实际就是二分法，就是右边的不再-1即可
/* The isBadVersion API is defined in the parent class VersionControl.
      boolean isBadVersion(int version); */

//public class Solution extends VersionControl {
//    public int firstBadVersion(int n) {
//        int left = 1;
//        int right = n;
//        int mid = 0;
//        while (left < right) {
//            mid = left + (right - left) / 2;
//            if (isBadVersion(mid)) {
//                right = mid;
//            } else {
//                left = mid + 1;
//            }
//        }
//        return left;
//    }
//}
